﻿<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="AdminHome.aspx.cs" Inherits="Admin_AdminHome" Title="南开大学滨海学院新闻网欢迎您"
    ValidateRequest="false" %>

<script runat="server">

    protected void NewsListGridView_DataBound(object sender, EventArgs e)
    {
        FoundCountLabel.Text = "共含有" + NewsListGridView.Rows.Count.ToString() + "条目";
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <!--Content-->
    <tr align="center" valign="top" style="width: 1000px">
        <td>
            <table style="width: 1000px; border: 0px;" cellspacing="0px" cellpadding="0px">
                <tr valign="middle">
                    <!--left-->
                    <td style="width: 90%" valign="top">
                        <table style="width: 100%; border: 0px;" cellspacing="0px" cellpadding="0px">
                            <tr style="width: 100%; height: 20px" align="left">
                                <td>
                                    <table style="width: 100%; border: 0px;" cellspacing="0px" cellpadding="0px">
                                        <tr style="height: 20px" align="left">
                                            <td style="width: 3%">
                                            </td>
                                            <td style="width: 65px" class="Guide">
                                                <label>
                                                    当前位置：</label>
                                            </td>
                                            <td style="width: 120px" class="Guide">
                                                <a href="AdminHome.aspx">滨海学院新闻网管理</a>
                                            </td>
                                            <td style="width: 20px" class="Guide">
                                                <label>
                                                    ></label>
                                            </td>
                                            <td class="Guide">
                                                <asp:Label ID="Management" runat="server">图片新闻管理</asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td style="width: 1px; background-color: #999999">
                            </td>
                            </tr>
                            
                            <tr>
                                <td>
                                    <table style="width: 100%; border: 0px;" cellspacing="0px" cellpadding="0px">
                                        <tr>

                                            <td align="left" valign="top" dir="ltr">
                                                <table style="width:100%; height: 5px; margin-bottom: 0px;">
                                                   <tr bgcolor="Silver" align="justify">
                                                        <td bgcolor="Silver" align="center">
                                                <asp:Button ID="SelectAllButton" runat="server" Text="全选" style="margin-left: 0px" 
                                                                Height="26px" Width="100px" onclick="SelectAllButton_Click" />
                         
                                                <asp:Button ID="SelectNoneButton" runat="server" Text="全不选" 
                                                                Height="26px" Width="100px" onclick="SelectNoneButton_Click" />
                                              
                                                <asp:Button ID="SelectOppositeButton" runat="server" Text="反选" Width="100px" 
                                                                Height="26px" onclick="SelectOppositeButton_Click"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                                
                                                <asp:GridView ID="NewsListGridView" runat="server" DataSourceID="SqlDataSource" 
                                                    AllowPaging="True"  PageSize="12" AutoGenerateColumns="False"
                                                    ShowFooter="True" ShowHeader="False" 
                                                    onrowdeleting="NewsListGridView_RowDeleting" 
                                                    onrowediting="NewsListGridView_RowEditing" 
                                                    onrowdatabound="NewsListGridView_RowDataBound" 
                                                    ondatabound="NewsListGridView_DataBound" Width="100%">
                                                <Columns>
                                                        <asp:TemplateField>
                                                            <ItemTemplate>
                                                                <table style="width: 100%; height: 22px; border: 0px;" cellspacing="0px" cellpadding="0px">
                                                                    <tr>
                                                                        </td>
                                                                        </td>
                                                                        <td style="width: 20px">
                                                                            <img alt="" src="../images/NewsIndex.jpg">
                                                                        </td>
                                                                        <td style="width: 1px">
                                                                            <asp:Label ID="News_id" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"News_id")%>' Visible="false"></asp:Label>
                                                                        </td>
                                                                        <td style="width: 380px" align="left">
                                                                            <asp:CheckBox ID="NewsCheckBox" runat="server" />
                                                                            <asp:Label ID="News_Title" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Title")%>'
                                                                                CssClass="Title" ></asp:Label>
                                                                        </td>
                                                                        <td style="width: 5px">
                                                                        </td>
                                                                         <td style="width: 40px">
                                                                             <asp:Label ID="CatalogLabel" runat="server" 
                                                                                 Text='<%# DataBinder.Eval(Container.DataItem,"Catalog_id") %>' Visible="False"></asp:Label></td>
                                                                        <td style="width: 5px">
                                                                        </td>
                                                                        <td style="width: 80px">
                                                                            <asp:Label ID="News_Time" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Time","{0:d}")%>' CssClass="Title"></asp:Label>
                                                                        </td>
                                                                        <td style="width: 5px">
                                                                        </td>
                                                                        <td style="width: 70px">
                                                                            <asp:Label ID="News_isPublished" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "isPublished").ToString()=="1" ? "已发布" : "未发布"%>' CssClass="Title"></asp:Label>
                                                                        </td>
                                                                        <td style="width: 5px">
                                                                        </td>
                                                                        <td style="width: 30px" align="right">
                                                                            <asp:LinkButton ID="Edit" runat="server" CommandName="Edit" Text="编辑" Font-Size="12px"
                                                                                ForeColor="#373737"></asp:LinkButton>
                                                                        </td>
                                                                        <td style="width: 30px" align="right">
                                                                            <asp:LinkButton ID="Delete" runat="server" CommandName="Delete" OnClientClick="return confirm('您确认删除吗？');"
                                                                                Text="删除" Font-Size="12px" ForeColor="#373737"></asp:LinkButton>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                </asp:GridView>
                                                <asp:SqlDataSource ID="SqlDataSource" runat="server" 
                                                    ConnectionString="<%$ ConnectionStrings:NewsConnectionString %>"
                                                    DeleteCommand="   "
                                                    SelectCommand="SELECT News.News_id, News.Title, News.Time, News.isPublished, News.Editor, News.Checker, NewsToCatalog.Catalog_id FROM News INNER JOIN NewsToCatalog ON News.News_id = NewsToCatalog.News_id WHERE (NewsToCatalog.Catalog_id = @catalogID) AND (@groupID = 1) OR (NewsToCatalog.Catalog_id = @catalogID) AND (@userID = News.Editor) ORDER BY News.Time DESC">
                                                    <SelectParameters>
                                                        <asp:Parameter DefaultValue="1" Name="catalogID" />
                                                        <asp:SessionParameter DefaultValue="0" Name="groupID" SessionField="GroupID" />
                                                        <asp:SessionParameter DefaultValue="0" Name="userID" SessionField="UserID" />
                                                    </SelectParameters>
                                                </asp:SqlDataSource>
                                                <asp:Label ID="FoundCountLabel" runat="server" Text="Label"></asp:Label>
                                                <table style="width: 100%; height: 20px;">
                                                    <tr bgcolor="Silver">
                                                    <td bgcolor="Silver" align="center">
                                                <asp:Button ID="New" runat="server" Text="新建"
                                                                Height="26px"  OnClick="New_Button_Click" Enabled="False" Visible="False"
                                                                Width="100px" />
                                                <asp:Button ID="DeleteSelectedButton" runat="server" CommandName="DeleteSelectedItem" 
                                                                OnClientClick="return confirm('您确认删除吗？');" Text="删除选中项" style="margin-left: 0px" 
                                                                Height="26px" onclick="DeleteSelectedButton_Click" Width="100px" 
                                                                Enabled="False" Visible="False" />
                                                <asp:Button ID="PublishSelectedButton" runat="server" Text="发布选中项" Enabled="False" 
                                                                Height="26px" onclick="PublishSelectedButton_Click" Visible="False" 
                                                                Width="100px" />
                                                <asp:Button ID="UnpublishSelectedButton" runat="server" Text="取消发布选中项" Enabled="False" 
                                                                Height="26px" onclick="UnpublishSelectedButton_Click" Visible="False" 
                                                                Width="100px"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td style="width: 1px; background-color: #999999">
                                </td>
                            </tr>
</asp:Content>
